package ProyectoX;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * Clase AutoRemove extiende a Thread
 */
public class AutoRemove extends Thread {
	protected JLabel label;
	protected JPanel panel;
	
	/**
	 * Constructor AutoRemove
	 * Inicializa los atributos.
	 * */
	public AutoRemove( JLabel label, JPanel panel ) {
		this.label = label;
		this.panel = panel;
	}
	
	/**
	 * Hace un sleep 
	 * Luego remueve el objeto del panel 
	 */
	public void run() {
		try {
			Thread.sleep(800);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		this.panel.remove(this.label);
		panel.repaint();

	}
}